/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package bs.ventas.modelo;

import bs.global.modelo.Auditoria;
import bs.stock.modelo.Producto;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Embedded;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author Claudio
 */
@Entity
@Table(name = "vt_lista_precio_item")
public class ItemListaPrecio implements Serializable {
    private static final long serialVersionUID = 1L;
    
    @Id
    @Column(name = "CODLIS", nullable = false, length = 10)
    private String codlis;    
    @Id
    @Column(name = "ARTCOD", nullable = false, length = 30)
    private String artcod;
    @Id
    @Column(name = "FECLIS", nullable = false)
    @Temporal(TemporalType.DATE)
    private Date feclis;

    @JoinColumn(name = "CODLIS", referencedColumnName = "CODIGO", nullable = false, insertable=false, updatable=false)
    @ManyToOne(fetch = FetchType.LAZY)
    private ListaDePrecio listaDePrecio;

    @JoinColumn(name = "ARTCOD", referencedColumnName = "CODIGO", nullable = false, insertable=false, updatable=false)    
    @ManyToOne(fetch = FetchType.LAZY)
    private Producto producto;

    @Column(name = "PRECIO", precision = 15, scale = 4)
    private BigDecimal precio;
        
    @Embedded
    private Auditoria auditoria;
    
    
    public ItemListaPrecio() {
    }

    public String getCodlis() {
        return codlis;
    }

    public void setCodlis(String codlis) {
        this.codlis = codlis;
    }

    public String getArtcod() {
        return artcod;
    }

    public void setArtcod(String artcod) {
        this.artcod = artcod;
    }

    public Date getFeclis() {
        return feclis;
    }

    public void setFeclis(Date feclis) {
        this.feclis = feclis;
    }
    
    public ListaDePrecio getListaDePrecio() {
        return listaDePrecio;
    }

    public void setListaDePrecio(ListaDePrecio listaDePrecio) {
        this.listaDePrecio = listaDePrecio;
    }

    public Producto getProducto() {
        return producto;
    }

    public void setProducto(Producto producto) {
        this.producto = producto;
    }

    public Auditoria getAuditoria() {
        return auditoria;
    }

    public void setAuditoria(Auditoria auditoria) {
        this.auditoria = auditoria;
    }
    
    public BigDecimal getPrecio() {
        return precio;
    }

    public void setPrecio(BigDecimal precio) {
        this.precio = precio;
    }

    @Override
    public int hashCode() {
        int hash = 7;
        hash = 23 * hash + (this.codlis != null ? this.codlis.hashCode() : 0);
        hash = 23 * hash + (this.artcod != null ? this.artcod.hashCode() : 0);
        hash = 23 * hash + (this.feclis != null ? this.feclis.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final ItemListaPrecio other = (ItemListaPrecio) obj;
        if ((this.codlis == null) ? (other.codlis != null) : !this.codlis.equals(other.codlis)) {
            return false;
        }
        if ((this.artcod == null) ? (other.artcod != null) : !this.artcod.equals(other.artcod)) {
            return false;
        }
        if (this.feclis != other.feclis && (this.feclis == null || !this.feclis.equals(other.feclis))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "ItemListaPrecio{" + "codlis=" + codlis + ", artcod=" + artcod + ", feclis=" + feclis + '}';
    }

    

}
